import QtQuick 2.15
//import QtQuick.Controls 1.4
import QtQuick.Controls 2.14
import QtQuick.Controls.Styles 1.4
import QtQuick.Extras 1.4
import QtQuick.Extras.Private 1.0

Item {
    width: 512
    height: 300
    signal setTtimer(int value)
    signal setHtimer(int value)

    Rectangle{
        x:0
        y:10
        width: 500
        height: 280
        border.width: 1
        border.color: "#33FF11"
        color: "#ddeeff"
        opacity: 0.7
        radius: 30
    }

    CheckBox{
        id:ckbox
        x:30
        y:30
        width: 40
        height: 40
        onCheckedChanged: {
            console.log(ckbox.checkState)
            if(ckbox.checkState > 0)
            {
                tttinfo.text = qsTr("当前风速: "+ sld.value.toString())
                ptr_hw.invokable_setMode(2)
                ptr_hw.invokable_setSpeed(sld.value)
            }
            else
            {
                tttinfo.text = qsTr("当前风速: 自动模式")
                ptr_hw.invokable_setMode(0)
            }
        }
    }

    Text {
        id: ttt0
        x:70
        y:30
        width: 60
        height: 40
        font.pixelSize: 20
        color: "#000000"
        horizontalAlignment: Text.AlignLeft
        verticalAlignment: Text.AlignVCenter
        text: qsTr("手动调速")
    }

    CheckBox{
        id:ckboxsltT
        x:170
        y:30
        width: 40
        height: 40
        onCheckedChanged: {
            console.log(ckboxsltT.checkState)
            if(ckboxsltT.checkState > 0)
            {
                setTtimer(2)
            }
            else
            {
                setTtimer(0)
            }
        }
    }

    Text {
        id: ttt1
        x:210
        y:30
        width: 80
        height: 40
        font.pixelSize: 20
        color: "#000000"
        horizontalAlignment: Text.AlignLeft
        verticalAlignment: Text.AlignVCenter
        text: qsTr("模拟温度")
    }

    CheckBox{
        id:ckboxsltH
        x:310
        y:30
        width: 40
        height: 40
        onCheckedChanged: {
            console.log(ckboxsltH.checkState)
            if(ckboxsltH.checkState > 0)
            {
                setHtimer(2)
            }
            else
            {
                setHtimer(0)
            }
        }
    }

    Text {
        id: ttt2
        x:350
        y:30
        width: 180
        height: 40
        font.pixelSize: 20
        color: "#000000"
        horizontalAlignment: Text.AlignLeft
        verticalAlignment: Text.AlignVCenter
        text: qsTr("模拟湿度")
    }

    Text {
        id: tttinfo
        x:206
        y:120
        width: 100
        height: 40
        font.pixelSize: 40
        color: "#000000"
        horizontalAlignment: Text.AlignHCenter
        verticalAlignment: Text.AlignVCenter
        text: qsTr("当前风速: 自动模式")
    }

    Slider {
        id:sld
        x:50
        y:200
        width: 400
        height: 50
        from:0
        to:10
        stepSize: 1
        onValueChanged: {
            if(ckbox.checkState > 0)
            {
                tttinfo.text = qsTr("当前风速: "+ sld.value.toString())
                ptr_hw.invokable_setSpeed(sld.value)
            }
        }
    }

    Item {
        x:50
        y:240
        width: 400
        height: 30

        Repeater {
            model: 11  // 0到100，每10一个刻度，共11个数字

            Column {
                x: 15 + index * (360 / 10)
                spacing: 0

                // Rectangle {
                //     anchors.horizontalCenter: parent.horizontalCenter
                //     width: 2
                //     height: 10
                //     color: "#121212"
                // }

                Text {
                    text: index.toString()
                    color: "#121212"
                    font.pixelSize: 16
                }
            }
        }
    }
}










